#ifndef _CPP_STORY_CONSOLE_COLOR_H_
#define _CPP_STORY_CONSOLE_COLOR_H_

#ifdef LINUX
#define red "\033[0;31m"
#define green "\033[0;32m"
#define yellow "\033[0;33m"
#define cyan "\033[0;36m"
#define white "\033[1;37m"
#define grey "\033[0;37m"
#define normal "\033[0m"
#endif

#ifdef WIN32
#include <windows.h>

//basic_ostream& operator<<( basic_ostream& (*_Pfn)(basic_ostream&) );
std::ostream& red(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_RED|FOREGROUND_INTENSITY);
    return s;
}

std::ostream& green(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_GREEN|FOREGROUND_INTENSITY);
    return s;
}

std::ostream& yellow(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY);
    return s;
}

std::ostream& cyan(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    return s;
}

std::ostream& white(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
    return s;
}

std::ostream& grey(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_INTENSITY);
    return s;
}

std::ostream& normal(std::ostream &s)
{
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout,
        FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    return s;
}
#endif

#endif

